import service from '@/request/index.js'

/*
 * 首页banner和推荐列表获取
 * @param offset 分页偏移 0
 * @param limit 分页大小  10
 */
export const fetchHomeRecommendList = (offset, limit = 10) => {
  return service.get(`/home/recommended/${offset}/${limit}`)
}

/*
 * 关注列表
 * @param offset 分页偏移 0
 * @param limit 分页大小  20
 */
export const fetchFollowList = (offset, limit = 20) => {
  return service.get(`/home/ffeeds/${offset}/${limit}`)
}

/* 笔记列表
 * @param offset 分页偏移 0
 * @param limit 分页大小  20
 */
export const fetchNoteList = (offset, limit = 20) => {
  return service.get(`/home/notes/${offset}/${limit}`)
}

/* 笔记详情
 * @param id 笔记id
 */
export const fetchNoteDetail = (id) => {
  return service.get(`/note/detail/${id}`)
}

/* 相关笔记
 * @param id 笔记id
 * @param offset 分页偏移 0
 * @param limit 分页大小  20
 */
export const fetchRelatedNotes = (id, offset = 0, limit = 20) => {
  return service.get(`/note/related/${id}/${offset}/${limit}`)
}

/* 话题详情
 * @param id 话题id
 * @param offset 分页偏移 0
 * @param limit 分页大小  20
 */
export const fetchTopicDetail = (id, offset = 0, limit = 20) => {
  return service.get(`/note/topicdetail/${id}/${offset}/${limit}`)
}

/* 菜谱详情
 * @param id 菜谱id
 */
export const fetchRecipeDetail = (id) => {
  return service.get(`/recipe/detail/${id}`)
}
